/*
 * StoryBaseLayer.h
 *
 *  Created on: 2015-9-21
 *      Author: gaoyu
 */

#ifndef STORYBASELAYER_H_
#define STORYBASELAYER_H_
#include "cocos2d.h"
#include "Roler.h"


USING_NS_CC;

class Story1Layer : public cocos2d::Layer{
public:
	CC_SYNTHESIZE_READONLY(TMXTiledMap *, m_map, Map);
	CC_SYNTHESIZE_READONLY(TMXObjectGroup *, m_objectMap, ObjectMap);

	Story1Layer();
	virtual ~Story1Layer();
    static cocos2d::Scene* createScene();
    CREATE_FUNC(Story1Layer);
    virtual bool init() override;
    virtual void update(float dt) override;

private:
    Roler *princess;
    Roler *prince;
    Roler *boss1;
    Roler *monster1;
    Roler *monster2;
    int   m_state;
    float m_lastTime;
    bool  m_isOpen;
    void mapInit();
    void roleInit();
    Point getPointFromObjectLayer(char* name);
    void  princessMoveEndCallback(Ref *sender);
    void  princeMoveEndCallback(Ref *sender);
    void  boss1MoveEndCallback(Ref *sender);
    void  monster1MoveEndCallback(Ref *sender);
    void  monster2MoveEndCallback(Ref *sender);
    void  actionEndCallback(Ref *sender);
    void  stateChange();
    void  stateChangePrepare();
    void  createAction();
};

#endif /* STORYBASELAYER_H_ */
